package Package.Example.Example_6;

import java.io.*;
import java.net.Socket;

public class Example_6 {
    public static void Example_6() throws IOException {
        //创建客户端Socket对象
        Socket s = new Socket("192.168.8.103",9900);
//封装文本文件的数据
        BufferedReader br = new BufferedReader(new
                FileReader("D:\\insert\\Example.txt"));
//封装输出流写数据
        BufferedWriter bw = new BufferedWriter(new
                OutputStreamWriter(s.getOutputStream()));
        String line;
        while ((line=br.readLine())!=null) {
            bw.write(line);
            bw.newLine();
            bw.flush();
        }
        s.shutdownOutput();
//接收反馈
        BufferedReader brClient = new BufferedReader(new
                InputStreamReader(s.getInputStream()));
        String data = brClient.readLine(); //等待读取数据
        System.out.println("服务器的反馈：" + data);
//释放资源
        br.close();
        s.close();
    }

}
